package plugins

import (
	"context"
	"data-transfer/domain"
)

type TargetStore interface {
	// InsertTest 仅为测试用
	InsertTest(ctx context.Context, rows []*domain.TEST_TARGET) (int64, error)

	//GetNewsById 根据主键获取ANNOUNCEMENT
	GetNewsById(ctx context.Context, id int64) (*domain.NEWS, error)
	//GetNews 获取所有资讯信息，用于插入infoService的Article表
	GetNews(ctx context.Context) ([]*domain.NEWS, error)
	//InsertNews 插入快讯新闻基本信息
	InsertNews(ctx context.Context, rows []*domain.NEWS) (int64, error)
	//InsertNewsSingle 插入快讯数据，用于goCanal监控
	InsertNewsSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateNews 更新快讯数据，用于goCanal监控
	UpdateNews(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteNews 删除快讯数据，用于goCanal监控
	DeleteNews(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	//HasNews 是否存在相应sourceKey的资讯新闻
	HasNews(sourceKey string) (bool, error)
	// InsertSkInfoChange 插入股票涨跌数据
	InsertSkInfoChange(ctx context.Context, rows []*domain.SK_INFO_CHANGE) (int64, error)
	// InsertSkInfoChangeSingle 插入股票涨跌数据，用于goCanal监控
	InsertSkInfoChangeSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	// UpdateSkInfoChange 更新股票涨跌数据，用于goCanal监控
	UpdateSkInfoChange(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteSkInfoChange 删除股票涨跌数据，用于goCanal监控
	DeleteSkInfoChange(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	// InsertCashFlow 新增现金流
	InsertCashFlow(ctx context.Context, rows []*domain.CASH_FLOW) (int64, error)
	// InsertCashFlowSq 新增单季度现金流
	InsertCashFlowSq(ctx context.Context, rows []*domain.CASH_FLOW_SQ) (int64, error)
	// UpdateCashFLow 更新现金流
	UpdateCashFLow(updateSql string, updateMap map[string]interface{}) (int64, error)
	// UpdateCashFLowSq 更新现金流-单季度
	UpdateCashFLowSq(updateSql string, updateMap map[string]interface{}) (int64, error)
	// DeleteCashFlow 删除现金流
	DeleteCashFlow(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	//DeleteCashFlowSq 删除现金流-单季度
	DeleteCashFlowSq(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	// InsertCashFlowSingle 新增现金流数据，用于gocanal监控
	InsertCashFlowSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//InsertCashFlowSqSingle 新增现金流数据-单季度，用于gocanal监控
	InsertCashFlowSqSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)

	// InsertIncomeStatementSingle 新增一般企业利润表数据，用于gocanal监控
	InsertIncomeStatementSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	// DeleteIncomeStatement 删除一般企业利润表数据
	DeleteIncomeStatement(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	// UpdateIncomeStatement 更新一般企业利润表数据
	UpdateIncomeStatement(updateSql string, updateMap map[string]interface{}) (int64, error)
	// InsertIncomeStatement 新增财务数据-企业利润表
	InsertIncomeStatement(ctx context.Context, rows []*domain.INCOME_STATEMENT) (int64, error)
	// InsertIncomeStatementSq 新增财务数据-单季度企业利润表
	InsertIncomeStatementSq(ctx context.Context, rows []*domain.INCOME_STATEMENT_SQ) (int64, error)

	// UpdateBalanceSheet 更新资产负债信息
	UpdateBalanceSheet(updateSql string, updateMap map[string]interface{}) (int64, error)
	// InsertBalanceSheetSingle  新增一般资产负债数据，用于gocanal监控
	InsertBalanceSheetSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	// DeleteBalanceSheet 删除资产负债数据
	DeleteBalanceSheet(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	// InsertBalanceSheet 新增财务数据-资产负债表
	InsertBalanceSheet(ctx context.Context, rows []*domain.BALANCE_SHEET) (int64, error)

	// InsertKeyIndicator 新增财务数据主要指标
	InsertKeyIndicator(ctx context.Context, rows []*domain.KEY_INDICATOR) (int64, error)
	//InsertKeyIndicatorSq 新增财务数据主要指标单季度
	InsertKeyIndicatorSq(ctx context.Context, rows []*domain.KEY_INDICATOR_SQ) (int64, error)
	//UpdateKeyIndicator 更新财务数据主要指标数据
	UpdateKeyIndicator(updateMap map[string]string) (int64, error)
	//UpdateKeyIndicatorSq 更新财务数据主要指标数据-单季度
	UpdateKeyIndicatorSq(updateSql string, updateMap map[string]interface{}) (int64, error)
	//InsertKeyIndicatorSingle 新增财务数据主要指标数据
	InsertKeyIndicatorSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	// InsertKeyIndicatorSqSingle 新增财务数据主要指标数据-单季度
	InsertKeyIndicatorSqSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//DeleteKeyIndicatorSq 删除财务数据-主要指标-单季度
	DeleteKeyIndicatorSq(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	//HasKeyIndicator 根据参数判断是否含有财务主要指标数据
	HasKeyIndicator(compCode string, symbol string, reportYear string, reportDateType string) (bool, error)
	//HasIncomeStatement 根据参数判断是否含有财务企业利润数据
	HasIncomeStatement(compCode string, symbol string, reportYear string, reportDateType string) (bool, error)
	//GetAnnouncementById 根据主键获取ANNOUNCEMENT
	GetAnnouncementById(ctx context.Context, id int64) (*domain.ANNOUNCEMENT, error)
	//GetAnnouncements 取得所有的ANNOUNCEMENT
	GetAnnouncements(ctx context.Context) ([]*domain.ANNOUNCEMENT, error)
	//FixAnnouncements 补充公告数据
	FixAnnouncements(ctx context.Context, rows []*domain.ANNOUNCEMENT) error
	// InsertAnnouncement 新增公告数据
	InsertAnnouncement(ctx context.Context, rows []*domain.ANNOUNCEMENT) (int64, error)
	// InsertAnnouncementSingle 新增公告数据，用户goCanal监控
	InsertAnnouncementSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	// UpdateAnnouncement 更新公告信息，用于gocanal监控
	UpdateAnnouncement(updateSql string, updateMap map[string]interface{}) (int64, error)
	// DeleteAnnouncement 删除公告信息
	DeleteAnnouncement(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	//ClearAnnouncement 定时任务清理一年前的数据
	ClearAnnouncement()
	//HasAnnouncement 是否存在相应HasAnnouncement的公告信息
	HasAnnouncement(AnnouncemtId int) (bool, error)
	//UpdateIncomeStatement4Bank 针对银行利润表更新财务利润信息
	UpdateIncomeStatement4Bank(updateMap map[string]string) (int64, error)
	//UpdateIncomeStatementSq 更新财务数据-利润表-单季度
	UpdateIncomeStatementSq(updateSql string, updateMap map[string]interface{}) (int64, error)
	//InsertIncomeStatementSqSingle 新增财务数据-利润表-单季度
	InsertIncomeStatementSqSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//DeleteIncomeStatementSq  删除财务数据-利润表-单季度
	DeleteIncomeStatementSq(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertEventRemind 新增公司大事提醒
	InsertEventRemind(ctx context.Context, rows []*domain.EVENT_REMIND) (int64, error)
	//InsertEventRemindSingle 新增公司大事提醒，用于goCanal监控
	InsertEventRemindSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateEventRemind 更新公司大事提醒，用于goCanal监控
	UpdateEventRemind(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteEventRemind 删除公司大事提醒，用于goCanal监控
	DeleteEventRemind(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertDividend 新增分红配送
	InsertDividend(ctx context.Context, rows []*domain.DIVIDEND) (int64, error)
	//InsertDividendSingle 新增分红配送，用于goCanal监控
	InsertDividendSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateDividend 修改分红配送，用于goCanal监控
	UpdateDividend(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteDividend 删除分红配送，用于goCanal监控
	DeleteDividend(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertMargin 新增融资融券
	InsertMargin(ctx context.Context, rows []*domain.MARGIN) (int64, error)
	// InsertMarginSingle 新增融资融券，用于goCanal监控
	InsertMarginSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateMargin 更改融资融券，用于goCanal监控
	UpdateMargin(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteMargin 删除融资融券，用于goCanal监控
	DeleteMargin(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	// InsertProfitForecast 新增公司业绩盈利预测
	InsertProfitForecast(ctx context.Context, rows []*domain.PROFIT_FORECAST) (int64, error)
	// InsertProfitForecastSingle 新增公司业绩盈利预测,用于goCanal监控
	InsertProfitForecastSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	// UpdateProfitForecast 更改公司业绩盈利预测,用于goCanal监控
	UpdateProfitForecast(updateSql string, updateMap map[string]interface{}) (int64, error)
	// DeleteProfitForecast 删除公司业绩盈利预测,用于goCanal监控
	DeleteProfitForecast(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	// InsertProfitForecastSingleNew 新增公司业绩盈利预测,用于goCanal监控
	InsertProfitForecastSingleNew(insertSql string, insertedMap map[string]string) (int64, error)
	// UpdateProfitForecastNew 更改公司业绩盈利预测，新增时使用,用于goCanal监控
	UpdateProfitForecastNew(updateSql string, updateMap map[string]string) (int64, error)
	// UpdateProfitForecastNew2 更改公司业绩盈利预测，单纯更新时使用,用于goCanal监控
	UpdateProfitForecastNew2(updateSql string, updateMap map[string]string) (int64, error)
	// DeleteProfitForecastNew 删除公司业绩盈利预测,用于goCanal监控
	DeleteProfitForecastNew(deleteSql string, deleteMap map[string]string) (int64, error)

	// InsertRatingCount 新增机构评级统计数据
	InsertRatingCount(ctx context.Context, rows []*domain.RATING_COUNT) (int64, error)

	//UpdateRatingCount 更新机构评级统计数据，用于goCanal监控
	UpdateRatingCount(updateSql string, row *domain.RATING_COUNT) (int64, error)
	//InsertRatingCountSingle 新增机构评级统计数据，用于goCanal监控
	InsertRatingCountSingle(insertSql string, row *domain.RATING_COUNT) (int64, error)
	// DeleteRatingCount 删除评级机构统计
	DeleteRatingCount(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	// HasRatingCount 判断是否存在某一证券的评级有效期的统计数据
	HasRatingCount(symbol string, ratingValid string) (bool, error)

	//GetLastRating 取得上次评级（根据ID主键递增性获得），用于goCanal监控
	GetLastRating(skcode string, reportdate string, ratingValid string, analystName string) (string, error)
	//InsertRating 插入机构评级信息
	InsertRating(ctx context.Context, rows []*domain.RATING) (int64, error)
	// UpdateRating 更改机构评级信息,用于goCanal监控
	UpdateRating(updateSql string, updateMap map[string]interface{}) (int64, error)
	//InsertRatingSingle 新增机构评级信息，用于goCanal监控
	InsertRatingSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//DeleteRating 删除机构评级信息，用于goCanal监控
	DeleteRating(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertEquityStructure 插入股本结构
	InsertEquityStructure(ctx context.Context, rows []*domain.EQUITY_STRUCTURE) (int64, error)
	//InsertEquityStructureSingle 插入股本结构 用于goCanal 监控
	InsertEquityStructureSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateEquityStructure  更改股本结构，用于goCanal监控
	UpdateEquityStructure(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteEquityStructure  删除股本结构，用于goCanal监控
	DeleteEquityStructure(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertEquityStruChg 插入股本变动
	InsertEquityStruChg(ctx context.Context, rows []*domain.EQUITY_STRUCTURE_CHANGE) (int64, error)
	//InsertEquityStruChgSingle 插入股本变动，用于goCanal监控
	InsertEquityStruChgSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdatetEquityStruChg  更改股本变动，用于goCanal监控
	UpdatetEquityStruChg(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeletetEquityStruChg  删除股本变动，用于goCanal监控
	DeletetEquityStruChg(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertTenCirculatingSharesHolder 插入十大流通股股东信息
	InsertTenCirculatingSharesHolder(ctx context.Context, rows []*domain.TEN_CIRCULATING_SHARES_HOLDER) (int64, error)
	//InsertTenCirculatingSharesHolderSingle 插入十大流通股股东，用于goCanal监控
	InsertTenCirculatingSharesHolderSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateTenCirculatingSharesHolder 更改十大流通股股东，用于goCanal监控
	UpdateTenCirculatingSharesHolder(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteTenCirculatingSharesHolder 删除十大流通股东，用于goCanal监控
	DeleteTenCirculatingSharesHolder(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertBonusFinancing 插入分红融资
	InsertBonusFinancing(ctx context.Context, rows []*domain.BONUS_FINANCING) (int64, error)
	//InsertBonusFinancingSingle 插入分红融资，用于goCanal监控
	InsertBonusFinancingSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateBonusFinancing 更新分红融资，用于goCanal监控
	UpdateBonusFinancing(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteBonusFinancing 删除分红融资，用于goCanal监控
	DeleteBonusFinancing(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertRankList 插入龙虎榜信息
	InsertRankList(ctx context.Context, rows []*domain.RANK_LIST) (int64, error)
	//InsertRankListSingle 插入龙虎榜信息，用于goCanal监控
	InsertRankListSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateRankList 更改龙虎榜信息，用于goCanal监控
	UpdateRankList(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteRankList 删除龙虎榜信息，用于goCanal监控
	DeleteRankList(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertBlockTrading  插入大宗交易
	InsertBlockTrading(ctx context.Context, rows []*domain.BLOCK_TRADING) (int64, error)
	//InsertBlockTradingSingle 插入大宗交易，用于goCanal监控
	InsertBlockTradingSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateBlockTrading 更改大宗交易，用于GoCanal监控
	UpdateBlockTrading(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteBlockTrading 删除大宗交易，用于goCanal监控
	DeleteBlockTrading(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertCompanyExecutives 插入公司高管信息
	InsertCompanyExecutives(ctx context.Context, rows []*domain.COMPANY_EXECUTIVES) (int64, error)
	//UpdateCompanyExecutives 更新公司高管信息
	UpdateCompanyExecutives(updateSql string, updateMap map[string]interface{}) (int64, error)
	//InsertCompanyExecutivesSingle 新增公司高管信息，用于goCanal监控
	InsertCompanyExecutivesSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//DeleteCompanyExecutives 删除公司高管信息，用于goCanal监控
	DeleteCompanyExecutives(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	// InsertMainComposition 插入公司主要业务
	InsertMainComposition(ctx context.Context, rows []*domain.MAIN_COMPOSITION) (int64, error)
	//InsertMainCompositionSingle 插入公司主要业务，用于goCanal监控
	InsertMainCompositionSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateMainComposition 更新公司主要业务，用于goCanal 监控
	UpdateMainComposition(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteMainComposition 删除公司主要业务，用于GoCanal监控
	DeleteMainComposition(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertCompanyProfile 插入公司基本情况信息
	InsertCompanyProfile(ctx context.Context, rows []*domain.COMPANY_PROFILE) (int64, error)
	//InsertCompanyProfileSingle 插入公司基本信息，用于goCanal监控
	InsertCompanyProfileSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateCompanyProfile 更新公司基本信息，用于goCanal监控
	UpdateCompanyProfile(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteCompanyProfile 删除公司基本信息，用于goCanal监控
	DeleteCompanyProfile(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertHolderChange 插入股东变动情况
	InsertHolderChange(ctx context.Context, rows []*domain.HOLDER_CHANGE) (int64, error)
	//InsertHolderChangeSingle 插入股东变动情况，用于goCanal监控
	InsertHolderChangeSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateHolderChange 更改股东变动情况，用于goCanal监控
	UpdateHolderChange(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteHolderChange 删除股东变动情况，用于goCanal监控
	DeleteHolderChange(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertTenHolder 插入十大股东
	InsertTenHolder(ctx context.Context, rows []*domain.TEN_HOLDER) (int64, error)
	//InsertTenHolderSingle 插入十大股东，用于goCanal监控
	InsertTenHolderSingle(insertSql string, insertedMap map[string]interface{}) (int64, error)
	//UpdateTenHolder 更改十大股东变动情况，用于goCanal监控
	UpdateTenHolder(updateSql string, updateMap map[string]interface{}) (int64, error)
	//DeleteTenHolder 删除股东变动情况，用于goCanal监控
	DeleteTenHolder(deleteSql string, deleteMap map[string]interface{}) (int64, error)

	//InsertLatestIndicator 插入最新指标
	InsertLatestIndicator(ctx context.Context, rows []*domain.LATEST_INDICATOR) (int64, error)
	//InsertLatestIndicatorSingle 插入最新指标，用于goCanal监控
	InsertLatestIndicatorSingle(insertSql string, insertedMap map[string]string) (int64, error)
	//UpdateLatestIndicator 更高最新指标，用于goCanal监控
	UpdateLatestIndicator(updateMap map[string]string) (int64, error)
	//DeleteLatestIndicator 删除最新指标
	DeleteLatestIndicator(deleteSql string, deleteMap map[string]interface{}) (int64, error)
	//HasLatestIndicator 是否含有最新指标
	HasLatestIndicator(compCode string, symbol string, reportYear string, reportDateType string) (bool, error)

	//InsertDataMonitor 插入数据变动情况
	InsertDataMonitor(rows []*domain.DATA_MONITOR) (int64, error)

	//DeleteBizData 初始化前删除业务数据
	DeleteBizData(tableName string) (int64, error)

	//GetLatestPublishDateProfitForecast 取得相关symbol的最新研报日期的盈利预测数据
	GetLatestPublishDateProfitForecast(symbol string) (*domain.PROFIT_FORECAST, error)

	//GetLatestPublishDateMainComposition  取得相关symbol的最新报表日期的公司经营状况数据
	GetLatestPublishDateMainComposition(symbol string, compCode string) (*domain.MAIN_COMPOSITION, error)

	// HasBizData 判断是否已经有业务主键的数据
	HasBizData(tableName string, condition ...string) (bool, error)

	//FixBizData 补充相应业务表的数据
	FixBizData(ctx context.Context, rows interface{}) error
}
